package com.mec.beans.y2012.coreservlet;

public class ItemOrder {

	private CatalogItem item;
	private int numItems;
	
	public ItemOrder(CatalogItem item){
		this(item, 1);
	}
	public ItemOrder(CatalogItem item, int numItems) {
		super();
		this.item = item;
		this.numItems = numItems;
	}
	
	public void incrementNumItems(){
		setNumItems(getNumItems() + 1);
	}
	
	public void cancelOrder(){
		setNumItems(0);
	}
	
	public Double getUnitCost(){
		return item.getCost();
	}
	
	public Double getTotalCost(){
		return getNumItems() * getUnitCost();
	}
	//
	public CatalogItem getItem() {
		return item;
	}
	public void setItem(CatalogItem item) {
		this.item = item;
	}
	public int getNumItems() {
		return numItems;
	}
	public void setNumItems(int numItems) {
		this.numItems = numItems;
	}
	
}
